
capture log close

set more off

use rep_final, clear
	keep if cit==0
	keep if marrinyr==2 & married==1 
	drop if citizen_sp==.	
	
	*draw graphs
	
	g post=0 if yrmarr<=2012
	replace post = 1 if (yrmarr>=2013 & yrmarr<=2016)
	replace post = 2 if (yrmarr>=2017)
	
	label define postl 0 "Pre-DACA" 1 "Obama 2013-2016" 2 "Trump 2017-2019"
	label values post postl

		
	*by pre-post
		foreach gr of varlist daca controlgrdaca {
									   
				*******************************************************
				display ""
				display "--------------------------------------"
				
				display "Group: `gr' "
				
				display "--------------------------------------"
				**********************************************************
		
			bys post: eststo: quietly estpost tabstat  ///
					age male yreduc ysm black white asian hispanic otherrace ///
					if `gr'==1 [fweight=perwt], listwise ///
					statistics(mean sd) columns(statistics)
		
			esttab using tableA3-`gr'.csv, replace main(mean) aux(sd) ///
						 nostar unstack nogaps nonote label
			eststo clear
			}
		 

